package cn.yunhe.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.yunhe.biz.IScoreBiz;
import cn.yunhe.biz.ScoreBizImpl;
import cn.yunhe.entity.University;

public class ScoreServlet extends HttpServlet {

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
		request.setCharacterEncoding("UTF-8");
		
		String getscore = request.getParameter("yourscore");
		String wenli = request.getParameter("wenorli");
		String getid = request.getParameter("pid");
		

		Integer intscore = Integer.parseInt(getscore);
		Integer intwenorli = Integer.parseInt(wenli);
		Integer intpid = Integer.parseInt(getid);
		
		
		IScoreBiz ScoreBiz = new ScoreBizImpl();
		
		if(intscore!=null&&intpid!=null&intwenorli!=null){
		 List<University> uni =  ScoreBiz.SearchProvince(intscore, intpid, intwenorli);
		 
		if(uni!=null){
			HttpSession session = request.getSession();
			session.setAttribute("uni", uni);
			request.getRequestDispatcher("ShowScore.jsp").forward(request, response);
			
				
			}else{
				response.sendRedirect("Score.jsp");
			}
		
		}
	}
	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}
}













